package com.starsoft.frame.core.service;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.starsoft.frame.core.orm.PageObject;

@Service
public class CommonService extends BaseService{
	
	public <B> B get(Class<B> entityClass, Serializable id) {
		return hibernateDao.get(entityClass, id);
	}
	
	public <B> B  getByMap(Class<B> entityClass, Map<String, Object> params) {
		return hibernateDao.getByMap(entityClass, params);
	}

	public void saveOrUpdate(Object entity) {
		hibernateDao.saveOrUpdate(entity);
	}
	
	public <B> void delete(Class<B> entityClass, Serializable... id) {
		hibernateDao.delete(entityClass, id);
	}

	public <B> Map<String, Object> pageQuery(Class<B> entityClass, PageObject po) {
		return hibernateDao.pageQuery(entityClass, po, new HashMap<String, Object>());
	}
	
	public <B> Map<String, Object> pageQuery(Class<B> entityClass, PageObject po, Map<String, Object> params) {
		return hibernateDao.pageQuery(entityClass, po, params);
	}

}
